﻿using AnyCAD.Foundation;
using AnyCAD.WPF.View;
using Rapid.Sketch.Plugin.Model;
using Rapid.Sketch.Plugin.ViewModel;
using RapidUI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Controls;

namespace Rapid.Sketch.Plugin.View
{
    /// <summary>
    /// SectionBarView.xaml 的交互逻辑
    /// </summary>
    public partial class SectionBarView : UserControl
    {
        public SectionBarView(ShapeElement instance, Document doc, PropertyChangedEventHandler callback)
        {
            InitializeComponent();
            this.DataContext = new SectionBarViewModel(instance, doc, callback);
        }
    }

    //定义属性界面创建方法
    public class SectionBarViewCreator : IPropertyViewCreator
    {
        public string Name { get => nameof(SectionBarModel); }

        public bool Create(StackPanel container, Element element, Document doc, PropertyChangedEventHandler callback)
        {
            container.Children.Add(new SectionBarView(ShapeElement.Cast(element), doc, callback));

            return true;
        }
    }
}
